class Solution:
    def reconstructQueue(self, people: list) -> list:
        people.sort(reverse=True, key=lambda x: (x[0], -x[1]))
        res = []
        for lists in people:
            res.insert(lists[1], lists)
        return res


a = Solution()
print(a.reconstructQueue([[7, 0], [4, 4], [7, 1], [5, 0], [6, 1], [5, 2]]))
print(a.reconstructQueue([]))
